use {
    super::{common::AppState, error_handle},
    axum::{extract::State, http::StatusCode, response::Json},
    repository::model::dapp_wallet::DAppWallet,
    sqlx::{MySql, Pool},
};
pub async fn generate_wallet(
    State(state): State<AppState>,
) -> Result<Json<DAppWallet>, (StatusCode, String)> {
    let mut one = wallet::generate_wallet();
    let id = DAppWallet::insert(&one, &state.pool)
        .await
        .map_err(error_handle::internal_error)?;

    one.id = Some(id);

    Ok(Json::from(one))
}
